package com.project.service;

import com.project.bean.UserBean;
import com.project.dao.IUserDao;
import com.project.dao.impl.IUserDaoImpl;
import com.project.server.Request;
import com.project.server.Response;

import java.time.LocalDate;

public class AddService implements Servlet{
    private IUserDao dao = new IUserDaoImpl();
    public void service(Request req , Response resp){

        UserBean userBean = new UserBean();
        userBean.setName(req.getParamMap("userName"));
        userBean.setPassword(req.getParamMap("pwd"));
        userBean.setDate(LocalDate.parse(req.getParamMap("birthday")));
        dao.add(userBean);
        FindAllService find = new FindAllService();
        find.service(req,resp);

    }
}
